package com.panda.controller;

import com.panda.entity.UserInfo;
import com.panda.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class LoginController {
    @Autowired
    private UserService userService;

    @RequestMapping("/login")
    @ResponseBody
    public UserInfo login(UserInfo info) {
        UserInfo info1 =  userService.findUser(info);
        if (info1 == null){
            info.setName("用户信息错误");
            return info;
        }else {
            return info1;
        }
    }
}
